/**
 * date : 2010-11-05
 * author : Kim Jong-sun
 * comment : MemberDAOImpl 구현
 */
package wetogether.member.dao;

import java.sql.SQLException;
import java.util.ArrayList;

import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

import wetogether.member.vo.MemberVO;

public class MemberDAOImpl extends SqlMapClientDaoSupport implements MemberDAO {
	// 아이디 중복 체크
	@Override
	public String isExistMemberById(String memberId) throws SQLException {
		return (String) super.getSqlMapClientTemplate().queryForObject("member.isExistMemberById", memberId);
	}
	
	// 비밀번호 체크
	@Override
	public String checkPassword(MemberVO memberVO) throws SQLException {
		return (String) super.getSqlMapClientTemplate().queryForObject("member.checkPassword", memberVO);
	}
	// 회원 가입
	@Override
	public void insertMember(MemberVO memberVO) throws SQLException {
		super.getSqlMapClientTemplate().insert("member.insertMember", memberVO);
	}
	
	// 회원 정보 수정
	@Override
	public void updateMemberInfo(MemberVO memberVO) throws SQLException {
		super.getSqlMapClientTemplate().update("member.updateMemberInfo", memberVO);
	}
	
	// 탈퇴
	@Override
	public void deleteMember(MemberVO memberVO) throws SQLException {
		super.getSqlMapClientTemplate().delete("member.deleteMember", memberVO);
	}
	
	// 회원 정보 가져오기
	@Override
	public MemberVO selectMemberInfo(String memberId) throws SQLException {
		return (MemberVO) super.getSqlMapClientTemplate().queryForObject("member.selectMemberInfo", memberId);
	}
	
	// 회원 목록 보기
	@Override
	public ArrayList<MemberVO> selectAllMemberList() throws SQLException {
		return (ArrayList<MemberVO>) super.getSqlMapClientTemplate().queryForList("member.selectAllMemberList");
	}
	
	// 로그인
	@Override
	public MemberVO login(MemberVO memberVO) throws SQLException {
		return (MemberVO) super.getSqlMapClientTemplate().queryForObject("member.login", memberVO);
	}	
}